<?php

class Ext_Login_Show_Adapter
{

    private $_adapter;

    public function __construct()
    {
        if(!isset($this->_adapter))
        {
            $front = Zend_Controller_Front::getInstance();
            $bootstrap = $front->getParam('bootstrap');
            $options = $bootstrap->getApplication()->getOptions();

            $classname = "Ext_Login_Show_Adapter_".ucfirst($options['auth']['adapter']['base']);
            if(!class_exists( $classname ))
            {
                require_once 'Ext/Login/Show/Exception.php';
                  throw new Ext_Login_Show_Exception("Login show form adapter '".$options['auth']['adapter']['base']."' not exists.");
            }
            
            $this->_adapter = new $classname();
        }
    }
    
    public function getAdapter(){
        return $this->_adapter;
    }
}
